<script language="JavaScript">

switch (this.nodeName.toUpperCase()) {
	case "SYMBOL":
		attachEvent("onclick", SearchParts);
		attachEvent("onmouseover", mouseover);
		attachEvent("onmouseout", mouseout);
		break;
	case "REFMNL":
		attachEvent("onclick", SearchManual);
		attachEvent("onmouseover", mouseover);
		attachEvent("onmouseout", mouseout);
		break;
	case "IMG":
		attachEvent("onclick", openSvg);
		attachEvent("onmouseover", chgBorder1);
		attachEvent("onmouseout", chgBorder2);
		break;
}

function mouseover() {
	this.style.color = "red";
}

function mouseout() {
	this.style.color = "royalblue";
}

function chgBorder1() {
	this.style.border = "thin solid blue";
}

function chgBorder2() {
	this.style.border = "thin solid white";
}

function SearchParts() {
	schwin = window.open("../sch/index.html?s=" + this.outerText.toUpperCase(), "", "");
}

function SearchManual() {
	var refmnl = this.outerText.toUpperCase().split("NO.")[1];
	var splitstr;
	if (location.protocol.indexOf("file") != -1) {
		splitstr = "\\";
	} else {
		splitstr = "/";
	}
	var fname = "";
	var patharray = location.pathname.split(splitstr);
	var ext = patharray[patharray.length-1].split("_")[1];
	if (ext != null) {
		fname = refmnl + "_" + ext;
	}
	var existdoc = true;
	var _xmltoc = new ActiveXObject('Microsoft.XMLDOM');
	_xmltoc.async = false;
	if (refmnl != "") {
		try {
			_xmltoc.load("../../" + refmnl + "/doc/toc.xml");
			schwin = window.open("../../" + refmnl + "/doc/index.html?f=" + fname, "", "");
		} catch(e) {
			existdoc = false;
		}
	}
}

function openSvg() {
	fplen = this.getAttribute("src").split("/").length;
	fn = this.getAttribute("src").split("/")[fplen-1];
	fn = fn.split(".")[0] + ".svgz";
	svgwin = window.open("","","toolbar=yes,location=no,derectories=no,resizable=yes,width=640,height=480");
	svgwin.focus();
	svgwin.document.writeln('<html>');
	svgwin.document.writeln('<head>');
	svgwin.document.writeln('<style>');
	svgwin.document.writeln('body {background-color: #CCCCCC; margin: 0px;}');
	svgwin.document.writeln('</style>');
	svgwin.document.writeln('<title>' + fn + '</title>');
	svgwin.document.writeln('</head>');
	svgwin.document.writeln('<body>');
	svgwin.document.writeln('<embed src="' + fn + '" name="SVG" pluginspage="http://www.adobe.com/svg/viewer/install" style="width:expression(document.body.clientWidth); height:expression(document.body.clientHeight)" type="image/svg-xml">');
	svgwin.document.writeln('<noembed>To view SVG pages, you will need to download the viewer.</noembed>');
	svgwin.document.writeln('</body>');
	svgwin.document.writeln('</html>');
	svgwin.document.close();
}

</script>
